<div class="text-c">
    <form action="" method="GET" id='condition'>
        日期范围：
        <input type="date" id="min_time" name="min_time" class="input-text Wdate" style="width:150px;" {notempty name='min_time'
            }value="{$min_time}" {/notempty}> -
        <input type="date" id="max_time" name="max_time" class="input-text Wdate" style="width:150px;" {notempty name='max_time'
            }value="{$max_time}" {/notempty}>
        <label class="btn btn-success radius">
            置顶:
            <select name="top" id="">
                <option value="0">全部</option>
                {notempty name='top'}
                <option value="1" {eq name='top' value="1" }selected{/eq}>已置顶</option>
                <option value="2" {eq name='top' value="2" }selected{/eq}>非置顶</option>
                {else/}
                <option value="1">已置顶</option>
                <option value="2">非置顶</option>
                {/notempty}
            </select>
        </label>
        <label class="btn btn-success radius">
            状态:
            <select name="status" id="">
                <option value="0">全部</option>
                {notempty name='status'}
                <option value="1" {eq name='status' value="1" }selected{/eq}>正常</option>
                <option value="2" {eq name='status' value="2" }selected{/eq}>下线</option>
                {else/}
                <option value="1">正常</option>
                <option value="2">下线</option>
                {/notempty}
            </select>
        </label>
        <input type="text" name="search" id="" {empty name="search" }placeholder=" 文章名称" {else/}value="{$search}" {/empty} style="width:250px;margin-left: 20px;"
            class="input-text">
        <button name="" id="" class="btn btn-success" type="submit">
            <i class="Hui-iconfont">&#xe665;</i> 搜文章</button>
        <a href="{:url('index')}" class="btn btn-danger">
            <i class="Hui-iconfont">&#xe68f;</i> 清除条件</a>
    </form>
</div>

<script type="text/javascript">
$("#min_time").blur(function (){
    var today = new Date()
    var y = today.getFullYear();
    var mon = today.getMonth() + 1;
    var d = today.getDate();
        mon = mon < 10 ? "0" + mon : mon;
        d = d < 10 ? "0" + d : d;
    var min_time = Date.parse(new Date($("#min_time").val()));
    console.log(today);
    console.log(min_time);
    if (min_time > today) {
        $("#min_time").val(y+'-'+mon+'-'+d);
    }
});

$("#max_time").blur(function (){
    var today = new Date()
    var y = today.getFullYear();
    var mon = today.getMonth() + 1;
    var d = today.getDate();
        mon = mon < 10 ? "0" + mon : mon;
        d = d < 10 ? "0" + d : d;
    var min_time = Date.parse(new Date($("#min_time").val()));
    var max_time = Date.parse(new Date($("#max_time").val()));
    console.log(today);
    console.log(min_time);
    if (min_time > max_time) {
        $("#max_time").val(y+'-'+mon+'-'+d);
    }
});

</script>